home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / Make / source / README.DOS < prev    next >
Encoding:
Text File  |  1997-08-27  |  13.5 KB  |  294 lines

  1. Port of GNU Make to 32-bit protected mode on MSDOS and MS-Windows.
  2.  
  3. Builds with DJGPP v2 port of GNU C/C++ compiler and utilities.
  4.  
  5.  
  6. New (since 3.74) DOS-specific features:
  7.  
  8.    1. Supports long filenames when run from DOS box on Windows 95.
  9.  
  10.    2. Supports both stock DOS COMMAND.COM and Unix-style shells
  11.       (details in ``Notes'' below).
  12.  
  13.    3. Supports DOS drive letters in dependencies and pattern rules.
  14.  
  15.    4. Better support for DOS-style backslashes in pathnames (but see
  16.       ``Notes'' below).
  17.  
  18.    5. The $(shell) built-in can run arbitrary complex commands,
  19.       including pipes and redirection, even when COMMAND.COM is your
  20.       shell.
  21.  
  22.    6. Can be built without floating-point code (see below).
  23.  
  24.    7. Supports signals in child programs and restores the original
  25.       directory if the child was interrupted.
  26.  
  27.    8. Can be built without (a previous version of) Make.
  28.  
  29.    9. The build process requires only standard tools.  (Optional
  30.       targets like "install:" and "clean:" still need additional
  31.       programs, though, see below.)
  32.  
  33.  
  34. To build:
  35.  
  36.    1. Unzip the archive, preserving the directory structure (-d switch
  37.       if you use PKUNZIP).  If you build Make on Windows 95, use an
  38.       unzip program that supports long filenames in zip files.
  39.  
  40.    2. Invoke the `configure.bat' batch file.
  41.  
  42.       If you are building Make in-place, i.e. in the same directory
  43.       where its sources are kept, just type "configure.bat" and press
  44.       [Enter].  Otherwise, you need to supply the path to the source
  45.       directory as an argument to the batch file, like this:
  46.  
  47.         configure.bat c:/djgpp/gnu/make-3.76
  48.  
  49.       Note the forward slashes: you MUST use them here.
  50.  
  51.    3. If configure.bat doesn't find a working Make, it will suggest to
  52.       use the `dosbuild.bat' batch file to build Make.  Either do as it
  53.       suggests or install another Make program (a pre-compiled binary
  54.       should be available from the usual DJGPP sites) and rerun
  55.       configure.bat.
  56.  
  57.    4. If you will need to run Make on machines without an FPU, you
  58.       might consider building a version of Make which doesn't issue
  59.       floating-point instructions (they don't help much on MSDOS
  60.       anyway).  To this end, edit the Makefile created by
  61.       configure.bat and add -DNO_FLOAT to the value of CPPFLAGS.
  62.  
  63.    5. Invoke Make.
  64.  
  65.       If you are building from outside of the source directory, you
  66.       need to tell Make where the sources are, like this:
  67.  
  68.             make srcdir=c:/djgpp/gnu/make-3.76
  69.  
  70.       (configure.bat will tell you this when it finishes).  You MUST
  71.       use a full, not relative, name of the source directory here, or
  72.       else Make might fail.
  73.  
  74.    6. After Make finishes, if you have a Unix-style shell installed,
  75.       you can use the `install' target to install the package.  You
  76.       will also need GNU Fileutils and GNU Sh-utils for this (they
  77.       should be available from the DJGPP sites).
  78.  
  79.       Without a Unix-style shell, you will have to install programs
  80.       and the docs manually.  Copy make.exe to a directory on your
  81.       PATH, make.i* info files to your Info directory, and update the
  82.       file `dir' in your Info directory by adding the following item
  83.       to the main menu:
  84.  
  85.     * GNU make: (make.info).           The GNU make utility.
  86.  
  87.       If you have the `install-info' program (from the GNU Texinfo
  88.       package), it will do that for you if you invoke it like this:
  89.  
  90.     install-info --info-dir=c:/djgpp/info c:/djgpp/info/make.info
  91.  
  92.       (If your Info directory is other than C:\DJGPP\INFO, change this
  93.       command accordingly.)
  94.  
  95.    7. The `clean' targets also require Unix-style shell and `test' and
  96.       `rm' programs (from Fileutils and Sh-utils, accordingly). 
  97.  
  98.  
  99.  
  100. Notes:
  101. -----
  102.  
  103.    1. The shell issue.
  104.  
  105.       This is probably the most significant improvement, first
  106.       introduced in the port of GNU Make 3.75.
  107.  
  108.       The original behavior of GNU Make is to invoke commands
  109.       directly, as long as they don't include characters special to
  110.       the shell or internal shell commands, because that is faster.
  111.       When shell features like redirection or filename wildcards are
  112.       involved, Make calls the shell.
  113.  
  114.       This port supports both DOS shells (the stock COMMAND.COM and its
  115.       4DOS/NDOS replacements), and Unix-style shells (tested with the
  116.       venerable Stewartson's `ms_sh' 2.3 and the DJGPP port of `bash' by
  117.       Daisuke Aoyama <jack@st.rim.or.jp>).
  118.  
  119.       When the $SHELL variable points to a Unix-style shell, Make
  120.       works just like you'd expect on Unix, calling the shell for any
  121.       command that involves characters special to the shell or
  122.       internal shell commands.  The only difference is that, since
  123.       there is no standard way to pass command lines longer than the
  124.       infamous DOS 126-character limit, this port of Make writes the
  125.       command line to a temporary disk file and then invokes the shell
  126.       on that file.
  127.  
  128.       If $SHELL points to a DOS-style shell, however, Make will not
  129.       call it automatically, as it does with Unix shells.  Stock
  130.       COMMAND.COM is too dumb and would unnecessarily limit the
  131.       functionality of Make.  For example, you would not be able to
  132.       use long command lines in commands that use redirection or
  133.       pipes.  Therefore, when presented with a DOS shell, this port of
  134.       Make will emulate most of the shell functionality, like
  135.       redirection and pipes, and shall only call the shell when a
  136.       batch file or a command internal to the shell is invoked.  (Even
  137.       when a command is an internal shell command, Make will first
  138.       search the $PATH for it, so that if a Makefile calls `mkdir',
  139.       you can install, say, a port of GNU `mkdir' and have it called
  140.       in that case.)
  141.  
  142.       The key to all this is the extended functionality of `spawn' and
  143.       `system' functions from the DJGPP library; this port just calls
  144.       `system' where it would invoke the shell on Unix.  The most
  145.       important aspect of these functions is that they use a special
  146.       mechanism to pass long (up to 16KB) command lines to DJGPP
  147.       programs.  In addition, `system' emulates some internal
  148.       commands, like `cd' (so that you can now use forward slashes
  149.       with it, and can also change the drive if the directory is on
  150.       another drive).  Another aspect worth mentioning is that you can
  151.       call Unix shell scripts directly, provided that the shell whose
  152.       name is mentioned on the first line of the script is installed
  153.       anywhere along the $PATH.  It is impossible to tell here
  154.       everything about these functions; refer to the DJGPP library
  155.       reference for more details.
  156.  
  157.       The $(shell) built-in is implemented in this port by calling
  158.       `popen'.  Since `popen' calls `system', the above considerations
  159.       are valid for $(shell) as well.  In particular, you can put
  160.       arbitrary complex commands, including pipes and redirection,
  161.       inside $(shell), which is in many cases a valid substitute for
  162.       the Unix-style command substitution (`command`) feature.
  163.  
  164.  
  165.    2. "SHELL=/bin/sh" -- or is it?
  166.  
  167.       Many Unix Makefiles include a line which sets the SHELL, for
  168.       those versions of Make which don't have this as the default.
  169.       Since many DOS systems don't have `sh' installed (in fact, most
  170.       of them don't even have a `/bin' directory), this port takes
  171.       such directives with a grain of salt.  It will only honor such a
  172.       directive if the basename of the shell name (like `sh' in the
  173.       above example) can indeed be found in the directory that is
  174.       mentioned in the SHELL= line (`/bin' in the above example), or
  175.       in the current working directory, or anywhere on the $PATH (in
  176.       that order).  If the basename doesn't include a filename
  177.       extension, Make will look for any known extension that indicates
  178.       an executable file (.exe, .com, .bat, .btm, .sh, and even .sed
  179.       and .pl).  If any such file is found, then $SHELL will be
  180.       defined to the exact pathname of that file, and that shell will
  181.       hence be used for the rest of processing.  But if the named
  182.       shell is *not* found, the line which sets it will be effectively
  183.       ignored, leaving the value of $SHELL as it was before.  Since a
  184.       lot of decisions that this port makes depend on the gender of
  185.       the shell, I feel it doesn't make any sense to tailor Make's
  186.       behavior to a shell which is nowhere to be found.
  187.  
  188.       Note that the above special handling of "SHELL=" only happens
  189.       for Makefiles; if you set $SHELL in the environment or on the
  190.       Make command line, you are expected to give the complete
  191.       pathname of the shell, including the filename extension.
  192.  
  193.       The default value of $SHELL is computed as on Unix (see the Make
  194.       manual for details), except that if $SHELL is not defined in the
  195.       environment, $COMSPEC is used.  Also, if an environment variable
  196.       named $MAKESHELL is defined, it takes precedence over both
  197.       $COMSPEC and $SHELL.  Note that, unlike Unix, $SHELL in the
  198.       environment *is* used to set the shell (since on MSDOS, it's
  199.       unlikely that the interactive shell will not be suitable for
  200.       Makefile processing).
  201.  
  202.       The bottom line is that you can now write Makefiles where some
  203.       of the targets require a real (i.e. Unix-like) shell, which will
  204.       nevertheless work when such shell is not available (provided, of
  205.       course, that the commands which should always work, don't
  206.       require such a shell).  More important, you can convert Unix
  207.       Makefiles to MSDOS and leave the line which sets the shell
  208.       intact, so that people who do have Unixy shell could use it for
  209.       targets which aren't converted to DOS (like `install' and
  210.       `uninstall', for example).
  211.  
  212.  
  213.    3. Default directories.
  214.  
  215.       GNU Make knows about standard directories where it searches for
  216.       library and include files mentioned in the Makefile.  Since
  217.       MSDOS machines don't have standard places for these, this port
  218.       will search ${DJDIR}/lib and ${DJDIR}/include respectively.
  219.       $DJDIR is defined automatically by the DJGPP startup code as the
  220.       root of the DJGPP installation tree (unless you've tampered with
  221.       the DJGPP.ENV file).  This should provide reasonable default
  222.       values, unless you moved parts of DJGPP to other directories.
  223.  
  224.  
  225.    4. Letter-case in filenames.
  226.  
  227.       If you run Make on Windows 95, you should be aware of the
  228.       letter-case issue.  Make is internally case-sensitive, but all
  229.       file operations are case-insensitive on Windows 95, so
  230.       e.g. files `FAQ', `faq' and `Faq' all refer to the same file, as
  231.       far as Windows is concerned.  The underlying DJGPP C library
  232.       functions honor the letter-case of the filenames they get from
  233.       the OS, except that by default, they down-case 8+3 DOS filenames
  234.       which are stored in upper case in the directory and would break
  235.       many Makefiles otherwise.  (The details of which filenames are
  236.       converted to lower case are explained in the DJGPP libc docs,
  237.       under the `_preserve_fncase' and `_lfn_gen_short_fname'
  238.       functions, but as a thumb rule, any filename that is stored in
  239.       upper case in the directory, is a legal DOS 8+3 filename and
  240.       doesn't include characters illegal on MSDOS FAT filesystems,
  241.       will be automatically down-cased.)  User reports that I have
  242.       indicate that this default behavior is generally what you'd
  243.       expect; however, since support for long filenames in the DJGPP
  244.       port of GNU Make is relatively new, your input is most welcome.
  245.  
  246.       In any case, if you hit a situation where you must force Make to
  247.       get the 8+3 DOS filenames in upper case, set FNCASE=y in the
  248.       environment or in the Makefile.
  249.  
  250.  
  251.    5. DOS-style pathnames.
  252.  
  253.       There are a lot of places throughout the program sources which
  254.       make implicit assumptions about the pathname syntax.  In
  255.       particular, the directories are assumed to be separated by `/',
  256.       and any pathname which doesn't begin with a `/' is assumed to be
  257.       relative to the current directory.  This port attempts to
  258.       support DOS-style pathnames which might include the drive letter
  259.       and use backslashes instead of forward slashes.  However, this
  260.       support is not complete; I feel that pursuing this support too
  261.       far might break some more important features, particularly if
  262.       you use a Unix-style shell (where a backslash is a quote
  263.       character).  I only consider support of backslashes desirable
  264.       because some Makefiles invoke non-DJGPP programs which don't
  265.       understand forward slashes.  A notable example of such programs
  266.       is the standard programs which come with MSDOS.  Otherwise, you
  267.       are advised to stay away from backslashes whenever possible.  In
  268.       particular, filename globbing won't work on pathnames with
  269.       backslashes, because the GNU `glob' library doesn't support them
  270.       (backslash is special in filename wildcards, and I didn't want
  271.       to break that).
  272.  
  273.       One feature which *does* work with backslashes is the filename-
  274.       related built-in functions such as $(dir), $(notdir), etc.
  275.       Drive letters in pathnames are also fully supported.
  276.  
  277.  
  278.  
  279. Bug reports:
  280. -----------
  281.  
  282.    Bugs that are clearly related to the MSDOS/DJGPP port should be
  283.    reported first on the comp.os.msdos.djgpp news group (if you cannot
  284.    post to Usenet groups, write to the DJGPP mailing list,
  285.    <djgpp@delorie.com>, which is an email gateway into the above news
  286.    group).  For other bugs, please follow the the procedure explained
  287.    in the "Bugs" chapter of the Info docs.  If you don't have an Info
  288.    reader, look up that chapter in the `make.i1' file with any text
  289.    browser/editor.
  290.  
  291.  
  292.    Enjoy,
  293.             Eli Zaretskii <eliz@is.elta.co.il>
  294.